document.getElementById('nav').addEventListener('click', e => {
    if (e.target.tagName === 'LI') {
      [...e.target.parentNode.children].forEach(li => li.classList.remove('active'));
      e.target.classList.add('active');
    }
  });
